package com.zyd.module.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zyd.common.util.Pagination;
import com.zyd.module.admin.mapper.PictureRoundMapper;
import com.zyd.module.admin.model.PictureRoundEntity;
import com.zyd.module.admin.model.Role;
import com.zyd.module.admin.service.PictureRoundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


/**
 * @author tiezhu
 * @date 2022年4月6日
 */
@Service("pictureRoundService")
public class PictureRoundServiceImpl extends ServiceImpl<PictureRoundMapper, PictureRoundEntity> implements PictureRoundService {

    @Autowired
    private PictureRoundMapper roundMapper;

    @Override
    public IPage<PictureRoundEntity> selectRounds(PictureRoundEntity roundEntity, Integer pageNumber, Integer pageSize) {
        IPage<PictureRoundEntity> page = new Pagination<>(pageNumber, pageSize);
        QueryWrapper<PictureRoundEntity> queryWrapper=new QueryWrapper<>();
        if (roundEntity.getPicDesc()!=null){
            queryWrapper.like("pic_desc",roundEntity.getPicDesc());
        }
        if (roundEntity.getClickPath()!=null){
            queryWrapper.like("click_path",roundEntity.getClickPath());
        }
        return  roundMapper.selectPage(page,queryWrapper);
    }
}